<template>
	<view class="page bg-white">
		<view class="main">
			<!-- 选择要加入的班级 -->
			<u-text color="#333" size="32rpx" text="选择要转入的班级" bold></u-text>
			<view class="form-item" @click="showClassPicker = true">
				<u-text :text="formData.classInfo || '请选择要转入的班级'" size="32rpx" color="#333"></u-text>
				<u-icon name="arrow-down" size="32rpx" color="#999"></u-icon>
			</view>

			<!-- 选择学员 -->
			<u-text margin="60rpx 0 0 0" color="#333" size="32rpx" text="选择转班学员" bold></u-text>
			<view class="form-item" @click="showStudentPopup = true">
				<u-text :text="formData.studentInfo || '请选择转班学员'" size="32rpx" color="#333"></u-text>
				<u-icon name="arrow-down" size="32rpx" color="#999"></u-icon>
			</view>

			<!-- 选择要加入的班级弹窗 -->
			<up-picker :closeOnClickOverlay="true" :show="showClassPicker" :columns="classList"
				@close="showClassPicker = false" @confirm="handleClassConfirm"></up-picker>

			<!-- 选择学员弹窗 -->
			<up-picker :closeOnClickOverlay="true" :show="showStudentPopup" :columns="studentList"
				@close="showStudentPopup = false" @confirm="handleStudentConfirm"></up-picker>

		</view>
		<view class="footer" :style="{ boxShadow: '0rpx -4rpx 36rpx 0rpx ' + themeTertiary }">
			<u-button shape="circle" size="large" :color="themePrimary" text="提交"></u-button>
		</view>
	</view>
</template>
<script setup>
import { ref } from 'vue'
import { useTheme } from '@/composables/useTheme';
const { themePrimary, themeTertiary } = useTheme();

// 报名周期弹窗
const showStartDate = ref(false)
const showEndDate = ref(false)
const formData = ref({
	startDate: '',
	endDate: '',
	classInfo: null,
	studentInfo: null,
})
// 选择要加入的班级弹窗
const showClassPicker = ref(false)
// 选择学员弹窗
const showStudentPopup = ref(false)

// 班级列表
const classList = ref([['托管班：一年级（A）班', '周末班：一年级-数学（A）班']])
// 学员列表
const studentList = ref([['张三', '李四', '王五']])


const handleClassConfirm = (e) => {
	console.log(e)
	showClassPicker.value = false
	formData.value.classInfo = e.value[0]
}

const handleStudentConfirm = (e) => {
	console.log(e)
	showStudentPopup.value = false
	formData.value.studentInfo = e.value[0]
}

const handleStartDateConfirm = (e) => {
	console.log(e)
	showStartDate.value = false
	formData.value.startDate = e.value
}

const handleEndDateConfirm = (e) => {
	console.log(e)
	showEndDate.value = false
	formData.value.endDate = e.value
}
</script>
<style scoped lang="scss">
.form-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: #F7F7F7;
	padding: 30rpx;
	margin-top: 20rpx;
	border-radius: 20rpx;
}

.camera-icon {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 54rpx;
	height: 54rpx;
}
</style>